/*
 * Created on Apr 18, 2004
 *
 * Vectrics Inc.  GNU Public License.
 */
package org.vectrics.company.web.struts;

import java.util.List;
import org.vectrics.common.pagelist.PageList;
import org.vectrics.company.CompanySelectCriteria;
import org.vectrics.provider.CoreServiceLocator;

/**
 * @author mmoore
 */
public class CompanyPageList extends PageList {
	/**
	 * 
	 */
	public CompanyPageList(CompanySelectCriteria criteria) {
		super();
		setCriteria(criteria);
	}

	/* (non-Javadoc)
	 * @see org.vectrics.common.pagelist.PageList#getTotalElementCount()
	 */
	public int getTotalElementCount() {
		
		int count = CoreServiceLocator.getCompanyService().findCompanyCount((CompanySelectCriteria)this.getCriteria());
		return(count);
	}

	/* (non-Javadoc)
	 * @see org.vectrics.common.pagelist.PageList#getElements(int, int)
	 */
	public List getElements(int startIndex, int endIndex) {
		List companyList = CoreServiceLocator.getCompanyService().findCompanies((CompanySelectCriteria)this.getCriteria(), 
					startIndex, endIndex);
		return(companyList);
	}

}
